<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="content-type">
  <title>Node</title>
</head>
<body>
<span style="font-family: Helvetica,Arial,sans-serif;"><span
 style="font-weight: bold;">Blend State</span><br>
<br>
<span style="font-style: italic;"></span>Blend states allow you to
combine colours together to produce effects. The colour currently
stored in the colour buffer is termed the <span
 style="text-decoration: underline;">Destination colour</span> and the
incoming colour is termed the <span style="text-decoration: underline;">Source
colour</span>. You can define how these colour are combined using a
Blend factor.<br>
<br>
Generally speaking the blending equation is;<br>
<br>
&nbsp;&nbsp;&nbsp; FinalColour = (SourceColour&nbsp; * S) +
(DestinationColour * D)<br>
<br>
&nbsp;&nbsp;&nbsp; where<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; S = Source Blending Factor<br>
&nbsp;&nbsp;&nbsp; D = Destination Blending Factor<br>
<br>
The blending factors are defined via the following, where subscript
s=SourceColour, d=DestinationColour;<br>
<br>
</span>
<table style="text-align: left; width: 100%;" border="1" cellpadding="2"
 cellspacing="2">
  <tbody>
    <tr>
      <td>Zero</td>
      <td>0, 0, 0</td>
      <td>0</td>
    </tr>
    <tr>
      <td>One</td>
      <td>1, 1, 1</td>
      <td>1</td>
    </tr>
    <tr>
      <td>SourceColor</td>
      <td>Rs, Gs, Bs</td>
      <td>As</td>
    </tr>
    <tr>
      <td>OneMinusSourceColor</td>
      <td>1, 1, 1 - Rs, Gs, Bs</td>
      <td>1 - As</td>
    </tr>
    <tr>
      <td>DestinationColor</td>
      <td>Rd, Gd, Bd</td>
      <td>Ad</td>
    </tr>
    <tr>
      <td>OneMinusDestinationColour</td>
      <td>1, 1, 1 - Rd, Gd, Bd</td>
      <td>1 - Ad</td>
    </tr>
    <tr>
      <td>SourceAlpha</td>
      <td>As, As, As</td>
      <td>As</td>
    </tr>
    <tr>
      <td>OneMinusSourceAlpha</td>
      <td>1, 1, 1 - As, As, As</td>
      <td>1 - As</td>
    </tr>
    <tr>
      <td>DestinationAlpha</td>
      <td>Ad, Ad, Ad</td>
      <td>Ad</td>
    </tr>
    <tr>
      <td>OneMinusDestinationAlpha</td>
      <td>1, 1, 1 - Ad, Ad, Ad</td>
      <td>1 - Ad</td>
    </tr>
    <tr>
      <td>ConstantColor</td>
      <td>Rc, Gc, Bc</td>
      <td>Ac</td>
    </tr>
    <tr>
      <td>OneMinusConstantColor</td>
      <td>1, 1, 1 - Rc, Gc, Bc</td>
      <td>1 - Ac</td>
    </tr>
    <tr>
      <td>ConstantAlpha</td>
      <td>Ac</td>
      <td>Ac</td>
    </tr>
    <tr>
      <td>OneMinusConstantAlpha</td>
      <td>1, 1, 1 - Ac, Ac, Ac</td>
      <td>1 - Ac</td>
    </tr>
    <tr>
      <td>SourceAlphaSaturate</td>
      <td>f, f, f</td>
      <td>1</td>
    </tr>
  </tbody>
</table>
<span style="font-family: Helvetica,Arial,sans-serif;"><br>
where f = min(As, 1 - Ad)<br>
<br>
e.g.<br>
<br>
Cd = 1, 0, 0, 1<br>
Cs = 0, 1, 0, 0.6<br>
<br>
S = SourceAlpha = 0.6<br>
D = OneMinusSourceAlpha = 1 - 0.6 = 0.4<br>
<br>
</span><span style="font-family: Helvetica,Arial,sans-serif;">FinalColour
= (SourceColour&nbsp; * S) + (DestinationColour * D)<br>
<br>
FinalColour = (Cs * 0.6) + (Cd * 0.4)<br>
</span>
</body>
</html>
